package cn.template.models;

import lombok.Data;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

@Data
@Entity
@DynamicUpdate
@Table(name = "companies")
public class Company extends BaseObject<Company> {
    private String name;
    private String province;
    private String city;
    private String address;
    private String manager;
    private String managerTel;

    public Company() {
    }

    public Company(String name, String province, String city, String address, String manager, String managerTel) {
        this.name = name;
        this.province = province;
        this.city = city;
        this.address = address;
        this.manager = manager;
        this.managerTel = managerTel;
    }

    @Override
    public void update(Company source) {
        this.name = source.getName();
        this.province = source.getProvince();
        this.city = source.getCity();
        this.address = source.getAddress();
        this.manager = source.getManager();
        this.managerTel = source.getManagerTel();
    }
}